.class final Lcom/wqmobile/sdk/a/c;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/util/Observer;


# instance fields
.field private synthetic a:Lcom/wqmobile/sdk/a/a;


# direct methods
.method constructor <init>(Lcom/wqmobile/sdk/a/a;)V
    .locals 0

    iput-object p1, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public final update(Ljava/util/Observable;Ljava/lang/Object;)V
    .locals 5

    const/4 v2, 0x0

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    const-string v0, "got the ads "

    invoke-static {v0}, Lcom/wqmobile/sdk/a/a;->b(Ljava/lang/String;)V

    instance-of v0, p1, Lcom/wqmobile/sdk/protocol/c;

    if-eqz v0, :cond_0

    instance-of v0, p2, Lcom/wqmobile/sdk/protocol/a/a;

    if-eqz v0, :cond_5

    check-cast p2, Lcom/wqmobile/sdk/protocol/a/a;

    invoke-virtual {p2}, Lcom/wqmobile/sdk/protocol/a/a;->j()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-virtual {p2}, Lcom/wqmobile/sdk/protocol/a/a;->h()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    if-lez v0, :cond_0

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v0}, Lcom/wqmobile/sdk/a/a;->a(Lcom/wqmobile/sdk/a/a;)Landroid/content/Context;

    move-result-object v0

    invoke-virtual {p2, v0}, Lcom/wqmobile/sdk/protocol/a/a;->a(Landroid/content/Context;)Ljava/util/List;

    move-result-object v1

    if-eqz v1, :cond_0

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-interface {v1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [B

    array-length v0, v0

    if-nez v0, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    iget-object v2, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v2}, Lcom/wqmobile/sdk/a/a;->b(Lcom/wqmobile/sdk/a/a;)Lcom/wqmobile/sdk/pojoxml/core/PojoXmlFactory;

    move-result-object v2

    invoke-virtual {v2}, Lcom/wqmobile/sdk/pojoxml/core/PojoXmlFactory;->CreateAdvertisementProperties()Lcom/wqmobile/sdk/pojoxml/core/PojoXml;

    move-result-object v2

    iput-object v2, v0, Lcom/wqmobile/sdk/a/a;->a:Lcom/wqmobile/sdk/pojoxml/core/PojoXml;

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    iget-object v0, v0, Lcom/wqmobile/sdk/a/a;->a:Lcom/wqmobile/sdk/pojoxml/core/PojoXml;

    invoke-virtual {p2}, Lcom/wqmobile/sdk/protocol/a/a;->h()Ljava/lang/String;

    move-result-object v2

    const-class v3, Lcom/wqmobile/sdk/model/AdvertisementProperties;

    invoke-interface {v0, v2, v3}, Lcom/wqmobile/sdk/pojoxml/core/PojoXml;->getPojo(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/wqmobile/sdk/model/AdvertisementProperties;

    invoke-virtual {v0, v1}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->setImageList(Ljava/util/List;)V

    :try_start_0
    new-instance v2, Ljava/io/ByteArrayInputStream;

    iget-object v1, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v1}, Lcom/wqmobile/sdk/a/a;->a(Lcom/wqmobile/sdk/a/a;)Landroid/content/Context;

    move-result-object v1

    invoke-virtual {p2, v1}, Lcom/wqmobile/sdk/protocol/a/a;->b(Landroid/content/Context;)Ljava/util/List;

    move-result-object v1

    const/4 v3, 0x0

    invoke-interface {v1, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, [B

    invoke-direct {v2, v1}, Ljava/io/ByteArrayInputStream;-><init>([B)V

    iget-object v1, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    iget-object v1, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v1}, Lcom/wqmobile/sdk/a/a;->a(Lcom/wqmobile/sdk/a/a;)Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v0}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->getAdID()Ljava/lang/String;

    move-result-object v3

    invoke-static {v1, v3}, Lcom/wqmobile/sdk/a/a;->b(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-static {v2, v1}, Lcom/wqmobile/sdk/b/a;->a(Ljava/io/InputStream;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_1
    iget-object v1, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "AdID:"

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->getAdID()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " Type:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->getType()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "  ActionType:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->getAction()Lcom/wqmobile/sdk/model/AdvertisementAction;

    move-result-object v2

    invoke-virtual {v2}, Lcom/wqmobile/sdk/model/AdvertisementAction;->getActionType()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "  offline:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->getIsOffline()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "  ImageList count:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v2}, Lcom/wqmobile/sdk/a/a;->a(Lcom/wqmobile/sdk/a/a;)Landroid/content/Context;

    move-result-object v2

    invoke-virtual {p2, v2}, Lcom/wqmobile/sdk/protocol/a/a;->a(Landroid/content/Context;)Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lcom/wqmobile/sdk/a/a;->c(Ljava/lang/String;)V

    invoke-virtual {v0}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->getIsOffline()Ljava/lang/String;

    move-result-object v1

    const-string v2, "Y"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_3

    invoke-static {}, Lcom/wqmobile/sdk/a/a;->g()Lcom/wqmobile/sdk/model/CacheOfflineADs;

    move-result-object v1

    if-nez v1, :cond_2

    new-instance v1, Lcom/wqmobile/sdk/model/CacheOfflineADs;

    invoke-direct {v1}, Lcom/wqmobile/sdk/model/CacheOfflineADs;-><init>()V

    invoke-static {v1}, Lcom/wqmobile/sdk/a/a;->a(Lcom/wqmobile/sdk/model/CacheOfflineADs;)V

    :cond_2
    invoke-static {}, Lcom/wqmobile/sdk/a/a;->g()Lcom/wqmobile/sdk/model/CacheOfflineADs;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/wqmobile/sdk/model/CacheOfflineADs;->addOfflineAD(Lcom/wqmobile/sdk/model/AdvertisementProperties;)V

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v0}, Lcom/wqmobile/sdk/a/a;->c(Lcom/wqmobile/sdk/a/a;)V

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    const/4 v1, 0x1

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/wqmobile/sdk/a/a;->a(Lcom/wqmobile/sdk/a/a;Ljava/lang/Boolean;)V

    goto/16 :goto_0

    :cond_3
    invoke-static {}, Lcom/wqmobile/sdk/a/a;->h()Ljava/util/List;

    move-result-object v1

    monitor-enter v1

    :try_start_1
    invoke-static {}, Lcom/wqmobile/sdk/a/a;->h()Ljava/util/List;

    move-result-object v2

    invoke-interface {v2, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    sget-object v2, Lcom/wqmobile/sdk/a/f;->a:Ljava/lang/Boolean;

    invoke-virtual {v2}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v2

    if-eqz v2, :cond_4

    const-string v2, "2TestNewLoop"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "add ad:"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lcom/wqmobile/sdk/model/AdvertisementProperties;->getAdID()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v2, v0}, Lcom/wqmobile/sdk/a/f;->a(Ljava/lang/String;Ljava/lang/String;)V

    :cond_4
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto/16 :goto_0

    :catchall_0
    move-exception v0

    monitor-exit v1

    throw v0

    :cond_5
    instance-of v0, p2, Lcom/wqmobile/sdk/protocol/a/c;

    if-eqz v0, :cond_0

    check-cast p2, Lcom/wqmobile/sdk/protocol/a/c;

    invoke-virtual {p2}, Lcom/wqmobile/sdk/protocol/a/c;->a()Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    const-string v0, "Got IA result"

    invoke-static {v0}, Lcom/wqmobile/sdk/a/a;->c(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v0}, Lcom/wqmobile/sdk/a/a;->d(Lcom/wqmobile/sdk/a/a;)Ljava/util/List;

    move-result-object v0

    invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/wqmobile/sdk/widget/ADView;

    invoke-virtual {v0}, Lcom/wqmobile/sdk/widget/ADView;->a()V

    iget-object v0, p0, Lcom/wqmobile/sdk/a/c;->a:Lcom/wqmobile/sdk/a/a;

    invoke-static {v0}, Lcom/wqmobile/sdk/a/a;->d(Lcom/wqmobile/sdk/a/a;)Ljava/util/List;

    move-result-object v0

    invoke-interface {v0, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    goto/16 :goto_0

    :catch_0
    move-exception v1

    goto/16 :goto_1
.end method
